package Swing;
import javax.swing.*;
import java.awt.*;
public class gridLayoutExam {
	static final int WIDTH=300;
	static final int HEIGHT=200;
	public static void main(String[] args) {
		JFrame jf = new JFrame("gridLayout example");
		jf.setSize(WIDTH, HEIGHT);
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jf.setVisible(true);
		
		JPanel contentPane = new JPanel();
		jf.setContentPane(contentPane);
		
		JButton b1 = new JButton("HONG KONG Dollar");
		JButton b2 = new JButton("Renminbi");
		JButton b3 = new JButton("U.S. Dollar");
		JButton b4 = new JButton("Euro");
		JButton b5 = new JButton("PoundSterling");
		JButton b6 = new JButton("Mainboard");
		JButton b7 = new JButton("EMS Memery");
		JButton b8 = new JButton("Hard Disk");
		JButton b9 = new JButton("Monitor");
		
		GridLayout grid = new GridLayout(3,3);
		contentPane.setLayout(grid);
		
		contentPane.add(b1);
		contentPane.add(b2);
		contentPane.add(b3);
		contentPane.add(b4);
		contentPane.add(b5);
		contentPane.add(b6);
		contentPane.add(b7);
		contentPane.add(b8);
		contentPane.add(b9);
		
		jf.pack();
	}
}